home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17828 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  56 lines

  1. Path: news.th-darmstadt.de!news
  2. From: enno@inferenzsysteme.informatik.th-darmstadt.de (Enno Sandner)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Circular Usage (forward declaration?)
  5. Date: 17 Apr 1996 20:05:47 +0200
  6. Organization: Fachbereich Informatik, TH Darmstadt
  7. Sender: enno@kitz.inferenzsysteme.informatik.th-darmstadt.de
  8. Message-ID: <lt20lmu3no.fsf@kitz.inferenzsysteme.informatik.th-darmstadt.de>
  9. References: <MRW.96Apr16184800@tobago.siemens.ch>
  10.     <ltu3ykovzc.fsf@kitz.inferenzsysteme.informatik.th-darmstadt.de>
  11.     <31747631.5970@datalytics.com> <MRW.96Apr17104121@tobago.siemens.ch>
  12.     <MRW.96Apr17105737@tobago.siemens.ch>
  13. NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
  14. In-reply-to: mrw@tobago.siemens.ch's message of 17 Apr 1996 08:57:37 GMT
  15. X-Newsreader: Gnus v5.1
  16.  
  17. In article <MRW.96Apr17105737@tobago.siemens.ch> mrw@tobago.siemens.ch (Waeckerlin Marc) writes:
  18.  
  19.    You have the same problem in other cases (yes I know there is an endless loop):
  20.  
  21.    class B;
  22.  
  23.    class A
  24.    {
  25.      public:
  26.        void b(B &x)
  27.        {
  28.      x.a(*this);
  29.        }
  30.    };
  31.  
  32.    class B
  33.    {
  34.      public:
  35.        void a(A &x)
  36.        {
  37.      x.b(*this);
  38.        }
  39.    };
  40.  
  41.  
  42.    It does not even work with pointers:
  43.  
  44.     [ ... ]
  45.  
  46.    -> is there a solution or not?
  47.    BTW: regarding the smart p[ointer example below - I know, that circular
  48.     references and smart pointers normally don't work tokether, but you
  49.     don't know how smart *these* smart pointers may be ;-) ...
  50.  
  51. It works with pointers and references if you put the definitions of
  52. the member-functions at the right place, i.e. have a seperate
  53. implementation file.
  54.  
  55.     Enno
  56.